<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
            String path = request.getContextPath();
            String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<%@ page import="com.news.bean.Link" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <base href="<%=basePath%>">

        <title>My JSP 'MyJsp001.jsp' starting page</title>

        <meta http-equiv="pragma" content="no-cache">
        <meta http-equiv="cache-control" content="no-cache">
        <meta http-equiv="expires" content="0">
        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
        <meta http-equiv="description" content="This is my page">
        <!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
        <script type="text/javascript">
            function upload(id,pic,img){
                window.showModalDialog('uploadpic.jsp?type=link&id='+id+'&pic='+pic,'ok', 'dialogwidth:380px;dialogheight:300px;help:0;center:1;resizable:0;status:0;scroll:0');
                window.location.reload();
                }
        </script>
    </head>
    <body>
    <LINK href="images/admin_css.css" type=text/css rel=stylesheet>
          <table class="tableBorder" width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#D2E8F6">
        <form action="link?link=add" method="post" enctype="multipart/form-data" >
            <tr>
                <td height="25" colspan="5" align="center" background="manage/main.files/HeadBG.gif">添加合作伙伴</td>
            </tr>
            <tr bgcolor="#F9F9F9">
                <td width="200" height="25" align="center">网站名称 </td>
                <td width="200" align="center">网站地址 </td>
                <td width="200" align="center">LOGO图片地址</td>
                <td width="50" align="center">排 序 </td>
                <td align="center">操 作 </td>
            </tr>
            <tr bgcolor="#FFFFFF">
                <td width="200" height="30" align="center" bgcolor="#FFFFFF"><input name="name" type="text" class="input" id="name" size="25">
                </td>
                <td width="200" align="center"><input name="address" type="text" class="input" id="address" size="26">
                </td>
                <td width="200" align="center"><input type="file" name="img_logo" value="" id="img_logo" size="14">
                </td>
                <td width="50" align="center"><input name="sort" type="text" class="input" id="sort" value=10 size="3"></td>
                <td align="center" bgcolor="#FFFFFF"><input name="Submit2" type="submit" class="button" value="添加友情链接"></td>
            </tr>
        </form>
    </table>
    <table class="tableBorder" width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#D2E8F6">
        <tr>
            <td height="25" colspan="5" align="center" background="manage/main.files/HeadBG.gif">友情链接列表</td>
        </tr>
        <tr bgcolor="#f9f9f9">
            <td width="200" height="25" align="center" bgcolor="#f9f9f9">网站名称</td>
            <td width="200" align="center" bgcolor="#f9f9f9">网站地址</td>
            <td width="200" align="center" bgcolor="#f9f9f9">LOGO图片</td>
            <td width="50" align="center" bgcolor="#f9f9f9">排 序</td>
            <td align="center" bgcolor="#f9f9f9">操 作</td>
        </tr>
        <%
            List<Link> list = (List) request.getAttribute("list");
            if (list != null && list.size() > 0) {
                for (Link L : list) {
        %>
        <form action="link?link=edit" method="post">
            <tr bgcolor="#f0f0f0">
            <input type="hidden" name="id" value="<%=L.getId()%>">
            <td width="200" height="25" align="center" bgcolor="#FFFFFF"><input type="text" name="name" value="<%=L.getName()%>" size="20" style="border-style : none">
            </td>
            <td width="200" align="center" bgcolor="#FFFFFF"><input type="text" name="address" value="<%=L.getAddress()%>" size="20" style="border-style : none">
            </td>
            <td width="200" height="50" align="center" bgcolor="#FFFFFF"><img onerror="this.src='img/nopic.jpg'" src="<%=L.getImg_logo()%>" width="200" height="50" alt="单击修改图片" onclick="upload('<%=L.getId()%>','<%=L.getImg_logo()%>',this);" /></td>
            <td width="50" align="center" bgcolor="#FFFFFF"><input type="text" name="sort" value="<%=L.getSort()%>" size="3" style="border-style : none">
            </td>
            <td align="center"><input name="Submit" type="submit" class="button" value=" 修 改 ">&nbsp;
                <a href="<%=basePath%>link?link=delete&id=<%=L.getId()%>" onclick="if(confirm('确定要删除吗?')){return true;}else{return false;}"><font color="#FF0000">删除</font></a> </td>

            </tr>
        </form>
        <%}
            }%>

    </table>
</body>
</html>
